//
//  YTXObject.h
//  Chart
//
//  Created by CaoJun on 15/2/15.
//
//

#ifndef __Chart__YTXObject__
#define __Chart__YTXObject__

namespace ytx
{
    
    class YTXObject {
    public:
        
    protected:
        // count of references
        unsigned int        m_uReference;
    public:
        YTXObject(void);
        /**
         *  @lua NA
         */
        virtual ~YTXObject(void);
        
        void release(void);
        void retain(void);
        bool isSingleReference(void) const;
        unsigned int retainCount(void) const;
        virtual bool isEqual(const YTXObject* pObject);
        
    };
    
    typedef void (YTXObject::*SEL_SCHEDULE)(float);
    typedef void (YTXObject::*SEL_CallFunc)();
    typedef void (YTXObject::*SEL_CallFuncN)(YTXObject*);
    typedef void (YTXObject::*SEL_CallFuncND)(YTXObject*, void*);
    typedef void (YTXObject::*SEL_CallFuncO)(YTXObject*);
    typedef void (YTXObject::*SEL_MenuHandler)(YTXObject*);
    typedef void (YTXObject::*SEL_EventHandler)(YTXObject*);
    typedef int (YTXObject::*SEL_Compare)(YTXObject*);
    
#define schedule_selector(_SELECTOR) (SEL_SCHEDULE)(&_SELECTOR)
#define callfunc_selector(_SELECTOR) (SEL_CallFunc)(&_SELECTOR)
#define callfuncN_selector(_SELECTOR) (SEL_CallFuncN)(&_SELECTOR)
#define callfuncND_selector(_SELECTOR) (SEL_CallFuncND)(&_SELECTOR)
#define callfuncO_selector(_SELECTOR) (SEL_CallFuncO)(&_SELECTOR)
#define menu_selector(_SELECTOR) (SEL_MenuHandler)(&_SELECTOR)
#define event_selector(_SELECTOR) (SEL_EventHandler)(&_SELECTOR)
#define compare_selector(_SELECTOR) (SEL_Compare)(&_SELECTOR)

}

#endif /* defined(__Chart__YTXObject__) */
